package com.alibaba.dubbo.dynamic;

import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.remoting.zookeeper.ZookeeperClient;
import com.alibaba.dubbo.remoting.zookeeper.zkclient.ZkclientZookeeperClient;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter4;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

/**
 * Created by wuyu on 2016/8/8.
 */
@SpringBootApplication
@MapperScan("com.alibaba.dubbo.dynamic.dao")
public class DynamicApplication {

    public static void main(String[] args) {
        SpringApplication.run(DynamicApplication.class, args);
    }

    @Bean
    public FastJsonHttpMessageConverter4 fastJsonHttpMessageConverter4() {
        return new FastJsonHttpMessageConverter4();
    }

    @Bean
    public ZookeeperClient zookeeperClient(@Value("${dynamic.zookeeper.url}") String zookeeperUrl) {
        return new ZkclientZookeeperClient(URL.valueOf(zookeeperUrl));
    }
}
